<?php
class Cl_CategoryManager extends WdkManager 
{
	/**
	 * 생성자
	 */
	function __construct()
	{
		parent::__construct();
		$this->dbo = Wdk::model(basename(__DIR__));
		$this->filter	= array();
		$this->order	= array("`category_code` ASC");
	}
	
	protected function newObj()
	{
		return Wdk::get(basename(__DIR__));
	}
	
	public function loadAll()
	{
		try
		{
			$this->listsize = 99999;
			$this->page = 1;
			parent::load();			
		} catch(NoRecordException $e){}
	}
	
	public function loadAllChild($category_code='')
	{
		try
		{
			$this->listsize = 99999;
			$this->page = 1;
			$this->where = array("`category_code` LIKE '{$category_code}'", "`category_code` != '{$category_code}'");
			parent::load();			
		} catch(NoRecordException $e){}
	}
	
	public function loadByDepth($category_code='')
	{
		try
		{
			$this->listsize = 99999;
			$this->page = 1;
			$this->where = array("LENGTH(`category_code`) = ".strlen($category_code));
			parent::load();			
		} catch(NoRecordException $e){}
	}
}